var oUl=document.getElementById('inspire');
var oLeft=document.getElementById('left');
var oRight=document.getElementById('right');
//var oLis=oUl.getElementsByTagName('li');
var animated = false;

function animate(offset){
	 animated = true;
	var newleft=parseInt(oUl.style.left)+offset;
    var time=236;
	var interval=10;
	var speed=offset/(time/interval);
	
	function go(){
	    if ( (speed > 0 && parseInt(oUl.style.left) < newleft) || (speed < 0 && parseInt(oUl.style.left) > newleft)) {
            oUl.style.left = parseInt(oUl.style.left) + speed + 'px';
			setTimeout(go,interval);
		}
		else{
		    oUl.style.left=newleft+'px';
	        if(newleft<-2360){
	            oUl.style.left='-1180px';
	        }
	        if(newleft>-1180){
	             oUl.style.left='-2360px';
	        }
			animated = false;
		}
	}
	go();
}

oLeft.onclick=function(){
	if(!animated){
   animate(-1180);}
}
oRight.onclick=function(){
    if(!animated){
   animate(1180);}
}	  